
***Cohold days share

*Number of days per individual or per household is 884

*Default definition of coholding (min 3,3)
*bysort ind_id: egen no_days_cohold = total(cohold_day) // already defined
*gen cohold_days_share = no_days_cohold/884 // already defined

bysort ind_id: egen no_days_cohold_HH = total(cohold_day_HH) if alwaysin2memberhh==1
gen cohold_days_share_HH = no_days_cohold_HH/884 if alwaysin2memberhh ==1

*Alternative definitions of coholding
gen cohold_day5D = 0 
replace cohold_day5D = 1 if od_exp>=5 & cons1>=5 
bysort ind_id: egen coholder5D = max(cohold_day5D) 
bysort ind_id: egen no_days_cohold5D = total(cohold_day5D) 
gen cohold_days_share5D = no_days_cohold5D/884

gen cohold_day5D_HH = 0 if alwaysin2memberhh ==1
replace cohold_day5D_HH = 1 if od_exp_HH>=5 & cons1_HH>=5 & alwaysin2memberhh==1
bysort ind_id: egen coholder5D_HH = max(cohold_day5D_HH) if alwaysin2memberhh==1
bysort ind_id: egen no_days_cohold5D_HH = total(cohold_day5D_HH) if alwaysin2memberhh==1
gen cohold_days_share5D_HH = no_days_cohold5D_HH/884 if alwaysin2memberhh ==1

foreach i in 10 15 20 25 30 {
gen cohold_day`i' = 0 
replace cohold_day`i' = 1 if od_exp>=`i' & cons1>=`i' 
bysort ind_id: egen coholder`i' = max(cohold_day`i') 
bysort ind_id: egen no_days_cohold`i' = total(cohold_day`i') 
gen cohold_days_share`i' = no_days_cohold`i'/884
}

foreach x in 10 15 20 25 30 {
gen cohold_day`x'_HH = 0 if alwaysin2memberhh ==1
replace cohold_day`x'_HH = 1 if od_exp_HH>=`x' & cons1_HH>=`x' & alwaysin2memberhh==1
bysort ind_id: egen coholder`x'_HH = max(cohold_day`x'_HH) if alwaysin2memberhh==1
bysort ind_id: egen no_days_cohold`x'_HH = total(cohold_day`x'_HH) if alwaysin2memberhh==1
gen cohold_days_share`x'_HH = no_days_cohold`x'_HH/884 if alwaysin2memberhh ==1
}


*Share days coholding: WITHOUT ZEROES
foreach var in cohold_days_share cohold_days_share5D cohold_days_share10 cohold_days_share15 cohold_days_share20 cohold_days_share25 cohold_days_share30 {
gen `var'_a0 = `var' if `var' != 0
}
foreach var in cohold_days_share_HH cohold_days_share5D_HH cohold_days_share10_HH cohold_days_share15_HH cohold_days_share20_HH cohold_days_share25_HH cohold_days_share30_HH {
gen `var'_a0 = `var' if `var' != 0
}



**********************************************************
*Table A10: Share of Co-holding Days for Couples
**********************************************************	 
estpost summarize ///
	cohold_days_share_HH_a0 cohold_days_share5D_HH_a0 ///
	cohold_days_share10_HH_a0 cohold_days_share15_HH_a0 ///
	cohold_days_share20_HH_a0 cohold_days_share25_HH_a0 ///
	cohold_days_share30_HH_a0 if edate_id==1335, detail
est store x
esttab x using "Tables/ShareDaysCoholding_HH.tex", replace ///
rename( ///
cohold_days_share_HH_a0 "Min(3;3)" ///
cohold_days_share5D_HH_a0 "Min(5;5)" ///
cohold_days_share10_HH_a0 "Min(10;10)" ///
cohold_days_share15_HH_a0 "Min(15;15)" ///
cohold_days_share20_HH_a0 "Min(20;20)" ///
cohold_days_share25_HH_a0 "Min(25;25)" ///
cohold_days_share30_HH_a0 "Min(30;30)") ///
collabels( \multicolumn{1}{c}{{Mean}} \multicolumn{1}{c}{{SD}} \multicolumn{1}{c}{{p50}} \multicolumn{1}{c}{{p75}} \multicolumn{1}{c}{{p90}} \multicolumn{1}{c}{{p95}}) ///
cells("mean(fmt(3)) sd(fmt(3)) p50(fmt(3)) p75(fmt(3)) p90(fmt(3)) p95(fmt(3))") ///
label nonumber nomtitle noobs nostar booktabs ///
substitute(; ,)



**********************************************************
*Table A8: Share of Co-holding Days for Single Individuals
**********************************************************	
estpost summarize ///
	cohold_days_share_a0 cohold_days_share5D_a0 cohold_days_share10_a0 ///
	cohold_days_share15_a0 cohold_days_share20_a0 cohold_days_share25_a0 ///
	cohold_days_share30_a0 if edate_id==1335 & alwaysin2memberhh==0, detail
est store x
esttab x using "Tables/ShareDaysCoholding_S.tex", replace ///
rename( ///
cohold_days_share_a0 "Min(3;3)" ///
cohold_days_share5D_a0 "Min(5;5)" ///
cohold_days_share10_a0 "Min(10;10)" ///
cohold_days_share15_a0 "Min(15;15)" ///
cohold_days_share20_a0 "Min(20;20)" ///
cohold_days_share25_a0 "Min(25;25)" ///
cohold_days_share30_a0 "Min(30;30)") ///
collabels( \multicolumn{1}{c}{{Mean}} \multicolumn{1}{c}{{SD}} \multicolumn{1}{c}{{p50}} \multicolumn{1}{c}{{p75}} \multicolumn{1}{c}{{p90}} \multicolumn{1}{c}{{p95}}) ///
cells("mean(fmt(3)) sd(fmt(3)) p50(fmt(3)) p75(fmt(3)) p90(fmt(3)) p95(fmt(3))") ///
label nonumber nomtitle noobs nostar booktabs ///
substitute(; ,)


**********************************************************
*Table A9: Share of Co-holding Days for Linked Individuals
**********************************************************	
estpost summarize ///
	cohold_days_share_a0 cohold_days_share5D_a0 cohold_days_share10_a0 ///
	cohold_days_share15_a0 cohold_days_share20_a0 cohold_days_share25_a0 ///
	cohold_days_share30_a0 if edate_id==1335 & alwaysin2memberhh==1, detail
est store x
esttab x using "Tables/ShareDaysCoholding_L.tex", replace ///
rename( ///
cohold_days_share_a0 "Min(3;3)" ///
cohold_days_share5D_a0 "Min(5;5)" ///
cohold_days_share10_a0 "Min(10;10)" ///
cohold_days_share15_a0 "Min(15;15)" ///
cohold_days_share20_a0 "Min(20;20)" ///
cohold_days_share25_a0 "Min(25;25)" ///
cohold_days_share30_a0 "Min(30;30)") ///
collabels( \multicolumn{1}{c}{{Mean}} \multicolumn{1}{c}{{SD}} \multicolumn{1}{c}{{p50}} \multicolumn{1}{c}{{p75}} \multicolumn{1}{c}{{p90}} \multicolumn{1}{c}{{p95}}) ///
cells("mean(fmt(3)) sd(fmt(3)) p50(fmt(3)) p75(fmt(3)) p90(fmt(3)) p95(fmt(3))") ///
label nonumber nomtitle noobs nostar booktabs ///
substitute(; ,)



********************************************************************************
*Cohold days share: histograms
********************************************************************************


*Recode
recode cohold_days_share (0.500001/1 = 0.575), gen(cohold_days_share_cat)
recode cohold_days_share_HH (0.500001/1 = 0.575), gen(cohold_days_share_HH_cat)

foreach i in 10 30 {
recode cohold_days_share`i' (0.500001/1 = 0.575), gen(cohold_days_share`i'_cat)
}

recode cohold_days_share5D_HH (0.500001/1 = 0.575), gen(cohold_days_share5D_cat_HH)

foreach x in 10 30 {
recode cohold_days_share`x'_HH (0.500001/1 = 0.575), gen(cohold_days_share`x'_cat_HH)
}



**********************************************************
*Figure 2: Share of Days Co-holding
**********************************************************	

*Any indivdiual
hist  cohold_days_share_cat if  cohold_days_share_cat != 0, frac width(0.05)  ///
fcolor(blue) lwidth(medium) lcolor(black) ///
title("Fraction of individuals", place(left) size(large)) ///
ytitle("") ///
xtitle("Fraction of days with coholding", size(large)) ///
ylabel(, labsize(medium) angle(0) format(%9.1fc)) ///
xlabel(0 0.1 0.2 0.3 0.4 0.5 0.575 ">0.5-1", labsize(medium) format(%9.1fc))
graph export "Figures/share_of_days_coholding_cohold_days_shareWL.pdf", replace
graph export "Figures/share_of_days_coholding_cohold_days_shareWL.png", replace

foreach i in 10 30 {
hist  cohold_days_share`i'_cat if  cohold_days_share`i'_cat != 0, frac width(0.05)  ///
fcolor(blue) lwidth(medium) lcolor(black) ///
title("Fraction of individuals", place(left) size(large)) ///
ytitle("") ///
xtitle("Fraction of days with coholding", size(large)) ///
ylabel(, labsize(medium) angle(0) format(%9.1fc)) ///
xlabel(0 0.1 0.2 0.3 0.4 0.5 0.575 ">0.5-1", labsize(medium) format(%9.1fc))
graph export "Figures/share_of_days_coholding_cohold_days_share`i'WL.pdf", replace
graph export "Figures/share_of_days_coholding_cohold_days_share`i'WL.png", replace
}

*Single individual
hist  cohold_days_share_cat if  cohold_days_share_cat != 0 & alwaysin2memberhh==0, frac width(0.05)  ///
fcolor(blue) lwidth(medium) lcolor(black) ///
title("Fraction of individuals", place(left) size(large)) ///
ytitle("") ///
xtitle("Fraction of days with coholding", size(large)) ///
ylabel(, labsize(medium) angle(0) format(%9.1fc)) ///
xlabel(0 0.1 0.2 0.3 0.4 0.5 0.575 ">0.5-1", labsize(medium) format(%9.1fc))
graph export "Figures/share_of_days_coholding_cohold_days_shareWL_S.pdf", replace
graph export "Figures/share_of_days_coholding_cohold_days_shareWL_S.png", replace

foreach i in 10 30 {
hist  cohold_days_share`i'_cat if  cohold_days_share`i'_cat != 0 & alwaysin2memberhh==0, frac width(0.05)  ///
fcolor(blue) lwidth(medium) lcolor(black) ///
title("Fraction of individuals", place(left) size(large)) ///
ytitle("") ///
xtitle("Fraction of days with coholding", size(large)) ///
ylabel(, labsize(medium) angle(0) format(%9.1fc)) ///
xlabel(0 0.1 0.2 0.3 0.4 0.5 0.575 ">0.5-1", labsize(medium) format(%9.1fc))
graph export "Figures/share_of_days_coholding_cohold_days_share`i'WL_S.pdf", replace
graph export "Figures/share_of_days_coholding_cohold_days_share`i'WL_S.png", replace
}

*Linked indivdiual
hist  cohold_days_share_cat if  cohold_days_share_cat != 0 & alwaysin2memberhh==1, frac width(0.05)  ///
fcolor(blue) lwidth(medium) lcolor(black) ///
title("Fraction of individuals", place(left) size(large)) ///
ytitle("") ///
xtitle("Fraction of days with coholding", size(large)) ///
ylabel(, labsize(medium) angle(0) format(%9.1fc)) ///
xlabel(0 0.1 0.2 0.3 0.4 0.5 0.575 ">0.5-1", labsize(medium) format(%9.1fc))
graph export "Figures/share_of_days_coholding_cohold_days_shareWL_L.pdf", replace
graph export "Figures/share_of_days_coholding_cohold_days_shareWL_L.png", replace

foreach i in 10 30 {
hist cohold_days_share`i'_cat if  cohold_days_share`i'_cat != 0 & alwaysin2memberhh==1, frac width(0.05)  ///
fcolor(blue) lwidth(medium) lcolor(black) ///
title("Fraction of individuals", place(left) size(large)) ///
ytitle("") ///
xtitle("Fraction of days with coholding", size(large)) ///
ylabel(, labsize(medium) angle(0) format(%9.1fc)) ///
xlabel(0 0.1 0.2 0.3 0.4 0.5 0.575 ">0.5-1", labsize(medium) format(%9.1fc))
graph export "Figures/share_of_days_coholding_cohold_days_share`i'WL_L.pdf", replace
graph export "Figures/share_of_days_coholding_cohold_days_share`i'WL_L.png", replace
}

*Household
hist cohold_days_share_HH_cat if  cohold_days_share_HH_cat != 0, frac width(0.05)  ///
fcolor(blue) lwidth(medium) lcolor(black) ///
title("Fraction of individuals", place(left) size(large)) ///
ytitle("") ///
xtitle("Fraction of days with coholding", size(large)) ///
ylabel(, labsize(medium) angle(0) format(%9.1fc)) ///
xlabel(0 0.1 0.2 0.3 0.4 0.5 0.575 ">0.5-1", labsize(medium) format(%9.1fc))
graph export "Figures/share_of_days_coholding_cohold_days_shareWL_HH.pdf", replace
graph export "Figures/share_of_days_coholding_cohold_days_shareWL_HH.png", width(1800) height(1300) replace

foreach i in 10 30 {
hist  cohold_days_share`i'_cat_HH if  cohold_days_share`i'_cat_HH != 0, frac width(0.05)  ///
fcolor(blue) lwidth(medium) lcolor(black) ///
title("Fraction of individuals", place(left) size(large)) ///
ytitle("") ///
xtitle("Fraction of days with coholding", size(large)) ///
ylabel(, labsize(medium) angle(0) format(%9.1fc)) ///
xlabel(0 0.1 0.2 0.3 0.4 0.5 0.575 ">0.5-1", labsize(medium) format(%9.1fc))
graph export "Figures/share_of_days_coholding_cohold_days_share`i'WL_HH.pdf", replace
graph export "Figures/share_of_days_coholding_cohold_days_share`i'WL_HH.png", width(1800) height(1300) replace
}






